import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'
import menus from './menu'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        // 基础路由
        {
            path:"/",
            redirect:"/login"
        },
         {
            path: '/login',
            name: 'login',
            component: () => import('../views/Login.vue')
        },
        {
            path: '/register',
            name: 'register',
            component: () => import('../views/Register.vue')
        },
        {
            path: '/home',
            name: 'home',
            component: HomeView,
            children:menus
            
        },

       
    ]
})
router.beforeEach((to, from, next) => {
    console.log('路由前置导航守卫==', to, from)
    next()

})

export default router
